home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
database
/
do1beta
/
date.do
< prev
next >
Wrap
Text File
|
1991-05-06
|
852b
|
37 lines
/*
this is an example of how to define methods for a built-in class
"cday" returns a character string naming the day
*/
method Date::cday(self)
{
if(dow(self) == 1) return("Sunday");
if(dow(self) == 2) return("Monday");
if(dow(self) == 3) return("Tuesday");
if(dow(self) == 4) return("Wednesday");
if(dow(self) == 5) return("Thursday");
if(dow(self) == 6) return("Friday");
if(dow(self) == 7) return("Saturday");
}
/*
define the same function, using the "switch" statement
*/
method Date::cday2(self)
{
switch(dow(self)) {
case 1: return("Sunday");
case 2: return("Monday");
case 3: return("Tuesday");
case 4: return("Wednesday");
case 5: return("Thursday");
case 6: return("Friday");
case 7: return("Saturday");
}
}
/*
call the methods defined above
*/
? cday(date());
? cday2(date());